import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/constants/font_family.dart';
import 'package:flutter_eve_plugin/constants/font_weight.dart';
import 'package:flutter_eve_plugin/model/ye_xiu/achieves/archieves_weapon_entity.dart';
import 'package:flutter_eve_plugin/utils/image_util.dart';
import 'package:flutter_eve_plugin/utils/screen_util.dart';

class ArchivesAdvancedItemWidget extends StatelessWidget {
  final bool lock;
  final ArchievesWeaponCurrentform form;
  const ArchivesAdvancedItemWidget({Key key, this.lock,this.form}) : super(key: key);

  @override
  Widget build(BuildContext context) {
   //达到最大形态不展示下一级
    String prefix = lock ? '' : "当前 ";
    return Offstage(
      offstage: form == null,
      child :Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: <Widget>[
        Stack(
          children: <Widget>[
            Container(
              width: setRatio(100),
              height: setRatio(103),
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(setRatio(10)),
                  image: DecorationImage(
                      fit: BoxFit.fill,
                      image: NetworkImage(
                          '${form?.picUrl ?? ''}'))),
            ),
            Positioned(
              bottom: 0,
              child: Container(
                width: setRatio(100),
                height: setRatio(16),
                decoration: BoxDecoration(
                    color: Color(0xFFFCAB2C),
                    borderRadius: BorderRadius.only(
                        bottomLeft: Radius.circular(setRatio(10)),
                        bottomRight: Radius.circular(setRatio(10)))),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    SizedBox(
                      width: setRatio(6),
                    ),
                    Text(
                      '千机伞',
                      style: TextStyle(
                          color: Color(0xFFFFFFFF),
                          fontFamily: FontFamily.PINGFANG,
                          fontWeight: FontWeightCustom.PF_Medium,
                          fontSize: setTextSp(9)),
                    ),
                    Expanded(
                      child: Container(),
                    ),
                    Text(
                      'Lv.${form?.formLevel}',
                      style: TextStyle(
                          color: Color(0xFFFFFFFF),
                          fontFamily: FontFamily.PMZD,
                          fontSize: setTextSp(10)),
                    ),
                    SizedBox(
                      width: setRatio(6),
                    ),
                  ],
                ),
              ),
            ),
            lock
                ? Container(
                    width: setRatio(100),
                    height: setRatio(103),
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(setRatio(10)),
                      color: Color(0x66000000),
                    ),
                    child: Center(
                      child: Image.asset(
                        imageUtilYeXiu(
                            'archives/icon_archivers_advanced_lock@3x'),
                        width: setRatio(26),
                        height: setRatio(25),
                      ),
                    ),
                  )
                : Container(),
          ],
        ),
        SizedBox(
          height: setRatio(5),
        ),
        Text(
          '$prefix ${form?.name ?? ''}',
          style: TextStyle(
              color: Color(0xFFFFFFFF),
              fontFamily: FontFamily.PINGFANG,
              fontWeight: FontWeightCustom.PF_Medium,
              fontSize: setTextSp(11)),
        )
      ],
    ));
  }
}
